!function () {
    var types = {
        alert(content, title, confirmCallback, options) {
            return mdui.alert(content, title, confirmCallback, Object.assign({
                history: false,
                confirmText: "确认"
            }, options))
        },
        confirm(content, title, confirmCallback, cancelCallback, options) {
            return mdui.confirm(content, title, confirmCallback, cancelCallback, Object.assign({
                history: false,
                confirmText: "确认",
                cancelText: "取消"
            }, options))
        },
        prompt(label, title, confirmCallback, cancelCallback, options) {
            return mdui.prompt(label, title, confirmCallback, cancelCallback, Object.assign({
                history: false,
                confirmText: "确认",
                cancelText: "取消"
            }, options))
        },
        select(content, title, buttons, selectCallback, options) {
            return mdui.dialog({
                title,
                content,
                buttons: buttons.map((v, i) => typeof v == "string" ? ({
                    text: v,
                    close: true,
                    onClick: function (e) {
                        selectCallback(v, i, e);
                    }
                }) : v),
                history: false,
                ...options
            })
        },
        dialog(...args) {
            var args = arguments || args;
            return mdui.dialog(...args);
        },
    }
    if (location.href.includes("/page")) {
        for (let i in types) {
            types[i] = function (...args) {
                return window.parent.mdui.$[i].apply(this, args);
            };
        }
    }
    Object.assign(mdui.$, types)
}();